#include "title.h"


Title_bar::Title_bar(QWidget *parent):QWidget(parent)
{
    setWindowFlags(Qt::FramelessWindowHint);
    setFixedSize(550,40);
    title_label = new QLabel(this);
    this->title_label->setText(tr("Kylin system upgrade package"));

    logo_label = new QLabel(this);
    logo_label->setFixedSize(22,22);
    logo_label->setPixmap(QPixmap(":/qmfile/res/logo.png"));

    mini_btn = new Button();
    mini_btn->setProperty("useIconHighlightEffect", 0x2);
    mini_btn->setProperty("isWindowButton", 0x01);
    mini_btn->setFlat(true);
    mini_btn->setIcon(QIcon::fromTheme("window-minimize-symbolic"));
    mini_btn->show();

    close_btn = new QPushButton();
    close_btn->setFixedSize(30,30);
    close_btn->setProperty("isWindowButton", 0x2);
    close_btn->setProperty("useIconHighlightEffect", 0x8);
    close_btn->setFlat(true);
    close_btn->setIcon(QIcon::fromTheme("window-close-symbolic"));
    close_btn->show();

    QHBoxLayout *hlayout =new QHBoxLayout;
    hlayout->addSpacing(10);
    hlayout->addWidget(logo_label);
    hlayout->addSpacing(5);
    hlayout->addWidget(title_label);
    hlayout->addStretch();
    hlayout->addWidget(mini_btn);
    hlayout->addSpacing(4);
    hlayout->addWidget(close_btn);
    hlayout->addSpacing(4);
    hlayout->setContentsMargins(0,0,0,0);
    setLayout(hlayout);
    show();
}


Title_bar::~Title_bar()
{
    delete this;
}
